package com.softa.web.controller.custom;

import com.softa.annotation.CurrentUser;
import com.softa.dao.dto.SysUserDTO;
import com.softa.dao.model.SysUser;
import com.softa.service.system.UserService;
import com.softa.web.controller.base.BaseController;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * 用户信息管理
 * Created by yangl on 2017/8/13.
 */
@Controller
@RequestMapping("/custom/user")
public class CustomUserController extends BaseController {

   @Autowired
   private UserService userService;

    @RequestMapping(value = "/update", method = RequestMethod.POST)
    @ResponseBody
    public String update(@CurrentUser SysUser loginUser, SysUserDTO userDTO) {
        String message="修改成功";
        try {
            message=userService.updateUser(userDTO);
        } catch (Exception e) {
            message="修改失败";
            logger.error(e.getMessage());
        }
        return message;
    }
}
